<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../share/taglib.jsp" %>
<%@ include file="../share/isReadOnly.inc" %>
<html>
<head>
<title>楼盘管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="/css/vip.css" type="text/css">
<script language="JavaScript">
//到指定的分页页面
function topage(page){
	var form = document.forms[0];
	form.page.value=page;
	form.submit();
}
function deleteBuilding(url) {
	if(!confirm('你确定要删除该楼盘吗？')) {
		return false;
	}
	window.location.href = url;
}
function queryBuilding() {
	document.forms[0].query.value = 'true';
	document.forms[0].submit();
}
function clearCondition() {
	document.forms[0].name.value = '';
	document.forms[0].status.value = '';
	document.forms[0].query.value = 'false';
	document.forms[0].submit();
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" marginwidth="0" marginheight="0">
<html:form action="/cms/house/building.do" method="post">
<html:hidden property="page"/>
<html:hidden property="query" styleId="query"/>
<html:hidden property="method" value="list"/>
  <table width="98%" border="0" cellspacing="1" cellpadding="2" align="center">
  	<tr bgcolor="f5f5f5"> 
      <td width="10%"><div align="right"><bean:message key="info.building.field.name"/>：</div></td>
      <td width="40%">
      	<html:text property="name" size="30"/>
      </td>
      
      <td width="15%"><div align="right"><bean:message key="info.building.field.status"/>：</div></td>
	  <td colspan="3">

	    <html:select property="status">
	      <html:option value="">-</html:option>
	      <html:option value="nonePublish"><bean:message key="info.building.status.nonePublish"/></html:option>
	      <html:option value="published"><bean:message key="info.building.status.published"/></html:option>
	      <html:option value="invalidate"><bean:message key="info.building.status.invalidate"/></html:option>
	    </html:select>

	  </td>
    </tr>
    
    <tr> 
      <td bgcolor="f5f5f5" colspan="6" align="center"><table width="100%" border="0" cellspacing="1" cellpadding="3">
          <tr> 
            <td width="5%"></td>
            <td width="85%">
              <button type="button" onClick="javascript:queryBuilding();">&nbsp;<bean:message key="display.query"/>&nbsp;</button>&nbsp;&nbsp;
              <button type="button" onClick="javascript:clearCondition();">清除查询条件</button>
            </td>
          </tr>
        </table></td>
    </tr>
  
    <tr><td colspan="6" bgcolor="#ffbe26" align="right">
    	<%@ include file="../share/fenye.jsp" %>
	</td></tr>
    <tr>
      <td width="10%" bgcolor="#ffbe26"> <div align="center"><font color="#000000">代号</font></div></td>
      <td width="40%" bgcolor="#ffbe26"> <div align="center"><font color="#000000">楼盘名称</font></div></td>
      <td width="15%" bgcolor="#ffbe26"> <div align="center"><font color="#000000">房源数</font></div></td>
      <td width="15%" bgcolor="#ffbe26"> <div align="center"><font color="#000000">状态</font></div></td>
      <td width="10%" bgcolor="#ffbe26"> <div align="center"><font color="#000000">推荐顺序</font></div></td>
      <!--td width="5%" nowrap bgcolor="#ffbe26"> <div align="center"><font color="#000000">修改</font></div></td-->
      <td width="10%" nowrap bgcolor="#ffbe26"> <div align="center"><font color="#000000">删除</font></div></td>
    </tr>
<!---------------------------LOOP START------------------------------>
<c:forEach items="${pageView.records}" var="entry">
    <tr>
      <td bgcolor="f5f5f5"><div align="center">${entry.buildingId}</div></td>
      <td bgcolor="f5f5f5"><div align="center"><a href="<html:rewrite action="/cms/house/building"/>?method=editUI&buildingId=${entry.buildingId}&type=Base">${entry.name}</a></div></td>
      <td bgcolor="f5f5f5"><div align="center">${fn:length(entry.houses)}</div></td>
      <td bgcolor="f5f5f5"><div align="center"><bean:message key="info.building.status.${entry.status}"/></div></td>
      <td bgcolor="f5f5f5"><div align="center">${entry.recommend != null ? entry.recommend : '-'}</div></td>
      <!--td bgcolor="f5f5f5"><div align="center"><a href="<html:rewrite action="/cms/house/building"/>?method=editUI&buildingId=${entry.buildingId}&type=Base">
	  	<img src="/images/edit.gif" width="15" height="16" border="0"></a></div>
	  </td-->
	  <c:if test="${entry.status eq 'nonePublish'}">
	  <td bgcolor="f5f5f5"><div align="center">
	  <% if (isReadOnly) { %>
	  <img src="/images/delete.gif" width="15" height="16" border="0" style="cursor:hand;">
	  <% } else { %>
	  <img src="/images/delete.gif" width="15" height="16" border="0" onclick="javascript:deleteBuilding('/cms/house/building.do?method=delete&buildingId=${entry.buildingId}');" style="cursor:hand;">
	  <% } %>
	  	</div>
	  </td>
	  </c:if>
	  <c:if test="${entry.status ne 'nonePublish'}"><td bgcolor="f5f5f5"><div align="center">-</div></td></c:if>
	  
	</tr>
</c:forEach>
    <!----------------------LOOP END------------------------------->
    <tr> 
      <td bgcolor="f5f5f5" colspan="6" align="center"><table width="100%" border="0" cellspacing="1" cellpadding="3">
          <tr> 
            <td width="5%"></td>
              <td width="85%">
              <input name="AddDic" type="button" <%=isReadOnly ? "disabled=\"disabled\"" : ""%> class="frm_btn" id="AddDic" onClick="javascript:window.location.href='<html:rewrite action="/cms/house/building"/>?method=addUI'" value="添加楼盘"> &nbsp;&nbsp;
            </td>
          </tr>
        </table></td>
    </tr>
  </table>
</html:form>
</body>
</html>